<%-- 
    Document   : AdminDashboard
    Created on : Feb 22, 2014, 10:39:07 AM
    Author     : Mukesh
--%>

<%@page import="State.StateBean"%>
<%@page import="Department.DepartmentBean"%>
<%@page import="Designation.DesignationBean"%>
<%@page import="Country.CountryBean"%>
<%@page import="Category.CategoryBean"%>
<%@page import="Course.CourseBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%@page import="FeeType.FeeTypeBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Employee").toString().equals("1")) {
%>
<html>
    <head>
        <title>Ramgovind Automated System</title>
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>

        </script>
        <script type="text/javascript">
            function loadEmployeeSalary()
            {
                document.getElementById('ssubmit').innerHTML = "<input class='btn btn-danger' style='margin:5px;' type='button' onclick=iback('2') value='Back'><input class='btn btn-primary' type='submit' value='Submit'>";
            }
        </script>

    </head>
    <body onload="loadEmployeeSalary()">
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">

            <div class="container-fluid">
                <%@include file="/Services/HR/hrsidenav.jsp" %>
                <div class="content">

                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Employee Registration</h3>
                                </div>
                                <div class="box-content box-nomargin">
                                    <%if (session.getAttribute("msg") != null) {%>
                                    <div class="modal" id="myModal">
                                        <div class="modal-header">
                                            <button type="button" class="close" onclick="document.getElementById('myModal').className = 'modal hide'"><img src="/RIT/img/mclose.png"></button>
                                            <h3><%=session.getAttribute("status")%></h3>
                                        </div>
                                        <div class="modal-body">
                                            <p><%=session.getAttribute("msg")%></p>
                                        </div>
                                        <div class="modal-footer">
                                            <a href="#" class="btn btn-primary" onclick="document.getElementById('myModal').className = 'modal hide'"> Ok </a>
                                        </div>
                                    </div>
                                    <%session.removeAttribute("msg");
                                        session.removeAttribute("status");%>
                                    <%}%>
                                    	
                                    <form method="post" action="/RIT/EmployeeRegistration" id='f1' enctype="multipart/form-data" class='validate form-horizontal bbq wizard'>
                                        <div class="step" id="step3">
                                            <ul class="steps">
                                                <li class="active" id="t1">
                                                    Step 1
                                                    <span>Login Details</span>
                                                </li>
                                                <li  id="t2">
                                                    Step 2
                                                    <span>Personal Details</span>
                                                </li>

                                            </ul>
                                        </div>
                                        <div class="box-content">
                                            <div class="tab-content" >
                                                <div class="tab-pane active" id="1">
                                                    <div class="control-group">

                                                        <label for="empName" class="control-label">Employee Name<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <input type="text" name="empName" id="empName" class='required' >
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label for="empDob" class="control-label">Employee DOB.<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <div class="input-append">
                                                                <input type="text" name="empDob" class='datepick required' id="empDob" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label for="email3" class="control-label">Email<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <div class="input-prepend">
                                                                <span class="add-on ficon-mail"></span>
                                                                <input type="text" name="email" id="email" class='email required' placeholder="user@domail.com" style="width: 185px">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label for="password" class="control-label">Password<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <input type="password" name="pwd" id="pwd" class='required' minlength="6">
                                                            <span id="result"></span>
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label for="cpassword" class="control-label">Confirm Password<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <input type="password" name="cpwd" id="cpwd" class='required' equalto="#pwd">
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label for="eType" class="control-label">User Type<span style="color:red">*</span></label>
                                                        <div class="controls">
                                                            <select name="eType" id="eType" class='required'>
                                                                <option value=''>Choose one</option>
                                                                <option value="Sub Admin">Sub Admin</option>
                                                                <option value="Employee">Employee</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="form-actions" style="margin: 20px -15px -15px -15px;">
                                                        <input class="btn btn-danger" id="back2" value="Back" type="reset" disabled="disabled">
                                                        <input class="btn btn-primary" id="next2" value="Next" type="button" onclick="inext('1')">
                                                    </div>
                                                </div>

                                                <div class="tab-pane" id="2">
                                                    <div class="row-fluid force-margin">
                                                        <div class="span5">
                                                            <div class="control-group">
                                                                <label for="fname" class="control-label">Father's Name<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="fname" id="fname" class="required" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="pcard" class="control-label">Pan Card<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="pcard" id="pcard" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="mno" class="control-label">Mobile NO.<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="mno" id="mno" class="required number" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="pno" class="control-label">Phone NO.</label>
                                                                <div class="controls">
                                                                    <input type="text" name="pno" id="pno" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="gender" class="control-label">Gender<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <select name="gender" id="gender" class="required" >
                                                                        <option value=''>Choose one</option>
                                                                        <option value="Male">Male</option>
                                                                        <option value="Female">Female</option>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="hquali" class="control-label">Higher Qualification<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="hquali" id="hquali" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="jdetail" class="control-label">Job Details<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="jdetail" id="jdetail">
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="add1" class="control-label">Address1<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="add1" id="add1" class="required" >
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="add2" class="control-label">Address2</label>
                                                                <div class="controls">
                                                                    <input type="text" name="add2" id="add2">
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="country" class="control-label">Country<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <select name="country" id="country" onchange="getState(this.value, 'state')" class="required">
                                                                        <option value=''>Choose one</option>
                                                                        <%{
                                                                                Vector<Object> list = Country.Query.viewAll();
                                                                                Iterator it = list.iterator();
                                                                                while (it.hasNext()) {
                                                                                    CountryBean cb = (CountryBean) it.next();

                                                                        %>
                                                                        <option value="<%=cb.getCountryId()%>"><%=cb.getCountryName()%></option>
                                                                        <%}
                                                                            }%>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="state" class="control-label">State<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <select name="state" id="state" class="required">
                                                                        <option value=''>Choose one</option>
                                                                        <%{
                                                                                Vector<Object> list = State.Query.viewAll();
                                                                                Iterator it = list.iterator();
                                                                                while (it.hasNext()) {
                                                                                    StateBean sb = (StateBean) it.next();

                                                                        %>
                                                                        <option value="<%=sb.getStateId()%>"><%=sb.getStateName()%></option>
                                                                        <%}
                                                                            }%>
                                                                    </select>
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="span5">
                                                            <div class="control-group">
                                                                <label for="photo" class="control-label">Employee Photo</label>
                                                                <div class="controls">
                                                                    <ul class="gallery">
                                                                        <li>
                                                                            <a href="" class="preview fancy" id="photo1"><img id="photo" style="height: 115px;width: 90px; cursor: -webkit-zoom-in;"src="" alt=""></a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="file" class="control-label">File upload<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <input type="file" name="photo" id="fileInput" onchange="setPhoto(this.id, 'photo')">
                                                                </div>
                                                            </div>

                                                            <div class="control-group">
                                                                <label for="pin" class="control-label">PIN<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="pin" id="pin" class="required number">
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="doj" class="control-label">Date Of joining<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="doj" id="doj" class="datepick required" readonly class="required">
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="gender" class="control-label">Department<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <select name="department" id="department" >
                                                                        <option value=''>Choose one</option>
                                                                        <%{
                                                                                Vector<Object> list = Department.Query.viewAll();
                                                                                Iterator it = list.iterator();
                                                                                while (it.hasNext()) {
                                                                                    DepartmentBean db = (DepartmentBean) it.next();

                                                                        %>
                                                                        <option value="<%=db.getDepartmentId()%>"><%=db.getDepartmentName()%></option>
                                                                        <%}
                                                                            }%>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="gender" class="control-label">Designation<span style="color:red"></span></label>
                                                                <div class="controls">
                                                                    <select name="designation" id="designation" >
                                                                        <option value=''>Choose one</option>
                                                                        <%{
                                                                                Vector<Object> list = Designation.Query.viewAll();
                                                                                Iterator it = list.iterator();
                                                                                while (it.hasNext()) {
                                                                                    DesignationBean db = (DesignationBean) it.next();

                                                                        %>
                                                                        <option value="<%=db.getDesignationId()%>"><%=db.getDesignation()%></option>
                                                                        <%}
                                                                            }%>
                                                                    </select>
                                                                </div>
                                                            </div>

                                                            <div class="control-group">
                                                                <label for="gender" class="control-label">Employee Type<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <select name="empType" id="empType" class="required">
                                                                        <option value=''>Choose one</option>
                                                                        <option value="1">Teaching</option>
                                                                        <option value="2">Non Teaching</option>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            <div class="control-group">
                                                                <label for="gender" class="control-label">Employee Status<span style="color:red">*</span></label>
                                                                <div class="controls">
                                                                    <select name="empStatus" id="empStatus" class="required">
                                                                        <option value=''>Choose one</option>
                                                                        <option value="1">Permanent</option>
                                                                        <option value="2">Contractual</option>
                                                                    </select>
                                                                </div>
                                                            </div>    

                                                        </div>
                                                    </div>
                                                    <div class="form-actions" style="margin: 20px -15px -15px -15px;">
                                                        <span id="ssubmit"></span>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>



        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
        <script>
                                                                        function inext(val) {
                                                                            $(function() {
                                                                                $("#f1").valid(); //validate form 1
                                                                                if ($("#f1").valid()) {
                                                                                    $("#myform").validate();
                                                                                    document.getElementById(val).className = 'tab-pane';
                                                                                    document.getElementById('t' + val).className = '';
                                                                                    var trg = parseInt(val) + 1;
                                                                                    document.getElementById(trg).className = 'tab-pane active';
                                                                                    document.getElementById('t' + trg).className = 'active';
                                                                                }
                                                                            });
                                                                        }

                                                                        function iback(val) {
                                                                            document.getElementById(val).className = 'tab-pane';
                                                                            document.getElementById('t' + val).className = '';
                                                                            var trg = parseInt(val) - 1;
                                                                            document.getElementById(trg).className = 'tab-pane active';
                                                                            document.getElementById('t' + trg).className = 'active';
                                                                        }
        </script>
        <script>
            /*
             jQuery document ready.
             */
            $(document).ready(function()
            {
                /*assigning keyup event to password field so everytime user type code will execute */
                $('#pwd').keyup(function()
                {
                    $('#result').html(checkStrength($('#pwd').val()))
                })

                /* checkStrength is function which will do the main password strength checking for us */

                function checkStrength(password)
                {
                    //initial strength
                    var strength = 0

                    //if the password length is less than 6, return message.
                    if (password.length < 6) {
                        $('#result').removeClass()
                        $('#result').addClass('short')
                        return 'Too short'
                    }
                    //length is ok, lets continue.

                    //if length is 8 characters or more, increase strength value
                    if (password.length > 7)
                        strength += 1

                    //if password contains both lower and uppercase characters, increase strength value
                    if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))
                        strength += 1

                    //if it has numbers and characters, increase strength value
                    if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))
                        strength += 1

                    //if it has one special character, increase strength value
                    if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/))
                        strength += 1

                    //if it has two special characters, increase strength value
                    if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/))
                        strength += 1

                    //now we have calculated strength value, we can return messages

                    //if value is less than 2
                    if (strength < 2)
                    {
                        $('#result').removeClass()
                        $('#result').addClass('weak')
                        return 'Weak'
                    }
                    else if (strength==2)
                    {
                        $('#result').removeClass()
                        $('#result').addClass('good')
                        return 'Good'
                    }
                    else
                    {
                        $('#result').removeClass()
                        $('#result').addClass('strong')
                        return 'Strong'
                    }
                }
            });
        </script>
        <style>
            .short{
                color:#FF0000;
            }
            .weak{
                color:#E66C2C;
            }
            .good{
                color:#2D98F3;
            }
            .strong{
                color:#006400;
            }
        </style>
    </body>
</html>


<%} else {
%>
<script type="text/javascript">
    alert("You Are Not Authorised");
    window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>
